package math_demo;

public class math常用api {
    public static void main(String[] args) {
        //取绝对值
        System.out.println(Math.abs(-10));//10
        //向上取整
        System.out.println(Math.ceil(4.1));//5
        //向下取整
        System.out.println(Math.floor(4.9));//4
        //次方
        System.out.println(Math.pow(2,3));//8
        //四舍五入
        System.out.println(Math.round(4.5));//5
        //随机数
        System.out.println(Math.random());//0-1double类型
    }
}
